<!DOCTYPE html>
<html>
    <head>
        <base target="_self">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0 , maximum-scale=1.0, user-scalable=0">
        <title>[测试投票]性感美女</title>
        <meta name="format-detection" content="telephone=no"/>
        <meta name="apple-mobile-web-app-capable" content="yes"/>
        <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
        <link href="style/touch.css" rel="stylesheet" type="text/css"/>
        <script src="style/jquery.js" type="text/javascript"></script>
        <script src="style/ajaxfileupload.js" type="text/javascript"></script>
        <script src="style/buildfileupload.js" type="text/javascript"></script>
        <script src="style/common.js" type="text/javascript"></script>
    </head>
    <body>
        <section class="top_box clearfix">
            <img src="style/common_469_pEILDPkE.jpg" />
        </section>
        <!--
        <header class="header_style clearfix">
            <a href="javascript:history.go(-1);"></a>
            <h1 style="color: #09ACDB;">报名参加</h1>
        </header>
        <section class="add_top_box clearfix">
            <a href="#" style="color: #09ACDB;">已经报名，点击登录管理</a>
        </section>
        -->
        <section class="add_form_box clearfix">
            <div class="add_form_box_main clearfix">
                <form id="addFrom" action="" method="post" enctype="multipart/form-data" onsubmit="return false;">
                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="30%"><label class="c1">姓名</label></td>
                            <td><input type="text" class="input_class" name="name" value="luomingui" id="bmname" placeholder="填写姓名"/></td>
                        </tr>
                        <tr>
                            <td><label class="c1">手机号</label></td>
                            <td><input type="text" class="input_class" name="phone" id="bmtel" value="13026209315" placeholder="填写手机号"/></td>
                        </tr>
                        <!--
                        <tr>
                            <td><label class="c1">管理密码</label></td>
                            <td><input type="text" class="input_class" name="bmpwd" id="bmpwd" value="123456" placeholder="填写管理密码"/></td>
                        </tr>
                        <tr>
                            <td colspan="2" style="line-height:20px;height:20px;">
                                <label class="c3" style="line-height:20px;height:20px; font-size: 13px;color: #949090;">
                                    填写一个你的密码，用于后面登录修改报名信息</label></td>
                        </tr>
                        <tr>
                            <td><label class="c1">详细介绍</label></td>
                            <td><textarea class="textarea_class" name="bmdesc" id="bmdesc"
                                          placeholder="填写详细介绍" cols="" rows="">填写一个你的密码，用于后面登录修改报名信息</textarea></td>
                        </tr>
                        -->
                        <tr>
                            <td><label class="c1">封面照片<br/>小于4000KB</label></td>
                            <td>
                                <input type="file" name="filedata1" id="filedata1" class="file_class" accept="image/*" capture="camera" />
                                <input type="hidden" name="bmpicurl" id="bmpicurl" value="">
                                <span id="picSpan"></span>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="line-height:20px;">
                                <label class="c3" style="line-height:20px;color: #949090;">
                                    （你现在上传的是封面图片，报名成功可以继续上传相册图片）
                                    <a href="#">不能上传图片点击这里</a></label></td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <input type="hidden" name="vid" value="1">
                                <input name="dosubmit" class="id_add_form_btn btn_class" style="background-color: #09ACDB;" type="button" value="保存并继续上传照片">
                                <div id="msg"></div>
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </section>
        <!-- footer start-->
        <section class="footer_block clearfix "></section>
        <footer class="footer_main clearfix">
            <link rel="stylesheet" type="text/css" href="style/daohang.css">
            <div class="bot_main">
                <ul>
                    <li class="ico_1"><a href="index.html"><span class="ico"><img src="style/i1.png" /></span><span class="txt">首页</span></a></li>
                    <li class="ico_3"><a href="applay.html"><span class="ico"><img src="style/i2.png" /></span><span class="txt">报名</span></a></li>
                    <li class="ico_2"><a href="ranking.html"><span class="ico"><img src="style/i3.png" /></span><span class="txt">排名</span></a></li>
                    <li class="ico_4"><a href="http://mp.weixin.qq.com/s?__biz=MzAxNzUzMjA3NA==&tempkey=9QqH4VjlxGVBDx09OjjMT%2FkXPl6902NysC3KFsKWhZ%2FhZmbtUjPOVqq5ieLEOzgf%2BvFJyv7MaUqu%2BH%2BhcO6GCIBCk0pcmwqGu3TW%2FiDdzvCoQOjUDmRSRSxJTXMhTQvJbegNVNswu7BFQ626t3GkJQ%3D%3D&#rd"><span class="ico"><img src="style/i4.png" /></span><span class="txt">自定义</span></a></li>
                </ul>
            </div>
        </footer>
        <!-- footer end-->
        <script type="text/javascript">
                    $(document).on('change', '#filedata1', function() {
                        loading('上传中...');
                        uploadsuccess = function(data) {
                            if (data == '') {
                                loading(false);
                                tusi('上传失败,稍后重试');
                            }
                            var dataarr = data.split('|');
                            if (dataarr[0] == 'OK') {
                                loading(false);
                                $("#bmpicurl").val(dataarr[2]);
                                $("#picSpan").html('<img width="60" height="60" src="' + dataarr[1] + '">');
                            } else if (dataarr[0] == 'SIZE') {
                                loading(false);
                                tusi('上传的图片超过允许尺寸');
                            } else if (dataarr[0] == "ERROR") {
                                loading(false);
                                tusi(dataarr[1]);
                            } else {
                                loading(false);
                                tusi('上传失败,稍后重试');
                            }
                        };
                        $.buildfileupload({
                            uploadurl: 'ajax.php?action=upload',
                            files: this.files,
                            uploadformdata: {},
                            uploadinputname: 'filedata1',
                            maxfilesize: "2000",
                            success: uploadsuccess,
                            error: function() {
                                loading(false);
                                tusi('上传失败，请稍后再试');
                            }
                        });
                    });
                    $(".id_add_form_btn").click(function() {
                        var bmname = $("#name").val();
                        var bmtel = $("#bmtel").val();
                        var bmpwd = $("#bmpwd").val();
                        var bmdesc = $("#bmdesc").val();
                        var bmpicurl = $("#bmpicurl").val();
                        if (bmname == "") {
                            tusi("必须填写姓名");
                            return false;
                        }
                        if (bmtel == '' || !checkMobile(bmtel)) {
                            tusi("请输入正确的手机号");
                            return false;
                        }
                        if (bmpwd == "") {
                            tusi("必须填写管理密码");
                            return false;
                        }
                        if (bmdesc == "") {
                            tusi("必须填写详细介绍");
                            return false;
                        }
                        if (bmpicurl == "") {
                            tusi("必须上传照片");
                            return false;
                        }
                        $.ajax({
                            type: "GET",
                            url: "ajax.php?action=add",
                            data: $('#addFrom').serialize(),
                            success: function(msg) {
                                if (msg == '201') {
                                    tusi("已经报名，点击登录管理");
                                    setTimeout(function() {
                                        window.location = "ajax.php?action=login";
                                    }, 1888);
                                } else if (msg == '200') {
                                    tusi("报名成功");
                                    setTimeout(function() {
                                        document.location.reload();
                                    }, 1888);
                                } else {
                                    tusi("报名失败，请重试");
                                    setTimeout(function() {
                                        document.location.reload();
                                    }, 1888);
                                }
                            }
                        });
                    });


        </script>
    </body>
</html>
